﻿using System;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using 历史记录;

namespace 调用例程
{
    internal class Program
    {
        private static void Main(string[] args)
        {
            //18446744073709551615
           

            Db = HistoryFactory.Creator<StorageModel>("测试文件.db", new HistoryInfo(bll: BLL.Submeter, timeout: new TimeSpan(TimeSpan.TicksPerSecond)));
            Db.Add(new StorageModel { Data = new int[] { 1, 2, 3, 4, 5, 6, 7, 8 } });



            //Task.Run(() =>
            //{
            //    while (true)
            //    {
            //        Db.Add(new StorageModel { Data = new int[] { 1, 2, 3, 4, 5, 6, 7, 8 } });
            //        Thread.Sleep(99);
            //    }
            //});

            Console.ReadKey();
            //HistoryFactory.StopAll();
            //Console.ReadKey();
            var a = Db.Queryable(new DateTime(), DateTime.Now);

            Console.ReadKey();
        }

        public static History<StorageModel> Db;
    }

    public class StorageModel : Model
    {
        public int[] Data { get; set; }
    }
}